#include "HashTable.h"
#include <stdio.h>
#include <stdlib.h>
void test0803()
{

    Hash_Table *ht = newHash_Table(43);
    ht->put(ht, "qiao", "zhiyin");
    ht->put(ht, "C", "CPP");
    ht->put(ht, "apple", "fruit");
    ht->put(ht, "banana", "fruit");
    ht->put(ht, "cat", "animal");
    ht->put(ht, "dog", "animal");
    ht->put(ht, "elephant", "animal");
    ht->put(ht, "frog", "animal");
    ht->put(ht, "grape", "fruit");
    ht->put(ht, "hat", "clothing");
    ht->put(ht, "igloo", "shelter");
    ht->put(ht, "jacket", "clothing");
    ht->put(ht, "kite", "toy");
    ht->put(ht, "lion", "animal");
    ht->put(ht, "mango", "fruit");
    ht->put(ht, "notebook", "stationery");
    ht->put(ht, "orange", "fruit");
    ht->put(ht, "pencil", "stationery");
    ht->put(ht, "quilt", "bedding");
    ht->print(ht);
    char **keyArray = NULL;
    size_t len;
    ht->getAllKey(ht, &keyArray, &len);
    for (int i = 0; i < len; ++i)
    {
        printf("%s\n", keyArray[i]);
    }
    printf("----------------------------\n");
    char **valArray = NULL;
    size_t len1;
    ht->getAllVal(ht, &valArray, &len1);
    for (int i = 0; i < len1; ++i)
    {
        printf("%s\n", valArray[i]);
    }
    char *s = NULL;
    ht->search(ht, "C", &s);
    printf("%s\n", s);
    free(s);
    s = NULL;
    ht->setVal(ht, "C", "OOP-C");
    ht->search(ht, "C", &s);
    printf("%s\n", s);
    double ret = 0.0;
    ht->getfactor(ht, &ret);
    printf("%.2lf\n", ret);
    ht->destroy(ht);
}
void test0804()
{
    Hash_Table *ht = newHash_Table(101);
    ht->put(ht, "qiao", "zhiyin");
}
int main(void)
{
    test0803();
    return 0;
}